package com.yvon.service.demo.netty.aio.server;


import com.yvon.service.demo.netty.aio.ChannelInitializer;

import java.nio.ByteBuffer;
import java.nio.channels.AsynchronousSocketChannel;
import java.nio.charset.Charset;
import java.util.concurrent.TimeUnit;

/**
 * 服务器通道初始化
 *
 * @author : Yvon
 * @since : 2022-11-11
 */
public class AioServerChannelInitializer extends ChannelInitializer {


    @Override
    protected void initChannel(AsynchronousSocketChannel channel) throws Exception {
        channel.read(ByteBuffer.allocate(1024), 10, TimeUnit.SECONDS, null, new AioServerHandler(channel, Charset.forName("GBK")));

    }
}
